home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-SPAR.{_A / SMPLOCK.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  896b  |  51 lines

  1. /*
  2.  * <asm/smplock.h>
  3.  *
  4.  * Default SMP lock implementation
  5.  */
  6. #include <linux/sched.h>
  7. #include <linux/interrupt.h>
  8. #include <asm/spinlock.h>
  9.  
  10. extern spinlock_t kernel_flag;
  11.  
  12. /*
  13.  * Release global kernel lock and global interrupt lock
  14.  */
  15. #define release_kernel_lock(task, cpu) \
  16. do { \
  17.     if (task->lock_depth >= 0) \
  18.         spin_unlock(&kernel_flag); \
  19.     release_irqlock(cpu); \
  20.     __sti(); \
  21. } while (0)
  22.  
  23. /*
  24.  * Re-acquire the kernel lock
  25.  */
  26. #define reacquire_kernel_lock(task) \
  27. do { \
  28.     if (task->lock_depth >= 0) \
  29.         spin_lock(&kernel_flag); \
  30. } while (0)
  31.  
  32.  
  33. /*
  34.  * Getting the big kernel lock.
  35.  *
  36.  * This cannot happen asynchronously,
  37.  * so we only need to worry about other
  38.  * CPU's.
  39.  */
  40. #define lock_kernel() \
  41. do { \
  42.     if (!++current->lock_depth) \
  43.         spin_lock(&kernel_flag); \
  44. } while(0)
  45.  
  46. #define unlock_kernel() \
  47. do { \
  48.     if (--current->lock_depth < 0) \
  49.         spin_unlock(&kernel_flag); \
  50. } while(0)
  51.